package com.itany.cloud.service;

import com.itany.cloud.service.impl.UserServiceFallback;
import com.itany.cloud.util.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

/**
 * @author 石小俊
 */
@Service
//@FeignClient(value = "cloud-nacos-provider",fallback = UserServiceFallback.class)
//@FeignClient(value = "cloud-nacos-gateway",fallback = UserServiceFallback.class)
@FeignClient(value = "cloud-nacos-gateway")
public interface UserServiceClient {

    @GetMapping("/users")
    ResponseResult findAll();

    @GetMapping("/users/{id}")
    ResponseResult findById(@PathVariable("id") Integer id);

    @PostMapping("/users")
    ResponseResult addUser(@RequestParam("username") String username, @RequestParam("password") String password);

    @PutMapping("/users")
    ResponseResult modifyUser(@RequestParam("id") Integer id, @RequestParam("username") String username, @RequestParam("password") String password);

    @DeleteMapping("/users/{id}")
    ResponseResult deleteById(@PathVariable("id") Integer id);

}
